package com.yssoft.entity.core;

import java.util.List;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.yssoft.entity.CommonEntity;

/**
 * 功能表实体类
 * t_functions
 * @author 
 */
@Table(name = "t_functions")
public class TFunctions extends CommonEntity{
    /**
     * 主键
     */
    @Id
    private Integer id;

    /**
     * 名称
     */
    private String name;

    /**
     * 编号
     */
    private String code;

    /**
     * 上级功能
     */
    private Integer parentId;

    /**
     * 序号
     */
    private Integer seqNum;

    /**
     * 描述
     */
    private String described;
	/**
	 * 菜单地址
	 */
    private String url;
    /** 功能权限类型：0-pc&app 1-pc 2-app*/
    private String type;
    @Transient
    private List<TFunctions> childrens;
    
    private static final long serialVersionUID = 1L;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Integer getParentId() {
	
		return parentId;
	}

	public void setParentId(Integer parentId) {
	
		this.parentId = parentId;
	}

	public Integer getSeqNum() {
	
		return seqNum;
	}

	public void setSeqNum(Integer seqNum) {
	
		this.seqNum = seqNum;
	}

	public String getDescribed() {
        return described;
    }

    public void setDescribed(String described) {
        this.described = described;
    }

    public List<TFunctions> getChildrens() {
	
		return childrens;
	}

	public void setChildrens(List<TFunctions> childrens) {
	
		this.childrens = childrens;
	}
	
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        TFunctions other = (TFunctions) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
            && (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId()))
            && (this.getSeqNum() == null ? other.getSeqNum() == null : this.getSeqNum().equals(other.getSeqNum()))
            && (this.getDescribed() == null ? other.getDescribed() == null : this.getDescribed().equals(other.getDescribed()))
            && (this.getUrl() == null ? other.getUrl() == null : this.getUrl().equals(other.getUrl()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            ;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode());
        result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode());
        result = prime * result + ((getSeqNum() == null) ? 0 : getSeqNum().hashCode());
        result = prime * result + ((getDescribed() == null) ? 0 : getDescribed().hashCode());
        result = prime * result + ((getUrl() == null) ? 0 : getUrl().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", name=").append(name);
        sb.append(", code=").append(code);
        sb.append(", parent_id=").append(parentId);
        sb.append(", seq_num=").append(seqNum);
        sb.append(", described=").append(described);
        sb.append(", url=").append(url);
        sb.append(", type=").append(type);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}